#include<bits/stdc++.h>
#define int long long
using namespace std;
int sum[1000005][2],a[1000005];
const int mod=1e9+7;
int ksm(int x,int y){
    int ret=1;
    while(y){
        if(y%2==1){ret=(ret*x)%mod;}
        x=(x*x)%mod;y/=2;
    }
    return ret;
}
int pw1[1000005],ny[1000005];
int C(int x,int y){
    return pw1[x]*ny[y]%mod*ny[x-y]%mod;
}
signed main(){
    freopen("game.in","r",stdin);
    freopen("game.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int n,k;cin>>n>>k;int pww=1,pw=1;pw1[0]=1;
    for(int i=n-1;i>=n-1-k+1;i--) pww=(pww*i)%mod;
    for(int i=1;i<=k;i++) pw=(pw*i)%mod;
    for(int i=1;i<=n;i++){pw1[i]=(pw1[i-1]*i)%mod;
        cin>>a[i];
    }
    ny[n]=ksm(pw1[n],mod-2);
    for(int i=n;i;i--){ny[i-1]=(ny[i]*i)%mod;}
    sum[1][0]=a[1];int op=0;
    for(int i=2;i<=n;i++){
        op=1-op;
        for(int j=min(i,n-k);j>=2;j--){
            if(i!=j){
                sum[j][1]=(sum[j][1]+sum[j][0]-a[i]*C(i-3,j-2)%mod+mod)%mod;
            }
            sum[j][0]=(sum[j-1][0]+sum[j-1][1]+a[i]*C(i-2,j-2)%mod)%mod;
        }
        if(i==2) sum[1][1]=(a[1]-a[2]+mod)%mod,sum[1][0]=0;
    }
    cout<<(sum[n-k][0]+sum[n-k][1])%mod*pw%mod*ksm(pww,mod-2)%mod;
    return 0;
}